home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************
-
- bin.c P. Stadelmann, June 1994
-
- Displays a long word in binary.
-
- *****************************************************/
-
-
- #include <SetUpA4.h>
- #include <Think_dcmd.h>
- #include <Think_put.h>
-
- void DoHelp( void )
- {
- PutPStr( "\pbin num");
- PutLine();
- PutPStr( "\p Displays the value in num as a binary long.");
- PutLine();
- }
-
- void DoJob()
- {
- long value;
- Boolean ok;
- Str255 myStr;
- short pos;
-
- if ( dcmdPeekAtNextChar() == '\r' )
- PutPStr( "\pValue not found" );
- else
- {
- pos = dcmdGetPosition();
- dcmdGetNextExpression( &value, &ok );
-
- if (ok)
- {
- dcmdSetPosition( pos );
- dcmdGetNextParameter( myStr );
- PutPStr( myStr );
- PutPStr( "\p = ");
- PutBinary(value, 32);
- }
- else
- PutPStr( "\pSyntax error");
- }
-
- PutLine();
-
- }
-
- pascal void CommandEntry( dcmdBlock* paramPtr )
- {
- RememberA0();
- SetUpA4();
-
- switch ( paramPtr->request )
- {
- case dcmdInit : break;
-
- case dcmdHelp : DoHelp();
- break;
-
- case dcmdDoIt : DoJob();
- break;
- }
-
- RestoreA4();
- }